// test_performance_minimal.rs
//! 最小化测试程序，只测试performance模块的功能

// 由于cargo无法单独编译一个模块，我们直接包含模块文件进行测试
mod performance {
    pub mod traits;
    pub mod connection;
    pub mod memory;
    pub mod async_pool;
    pub mod config;
    
    // 重新导出主要类型和函数
    pub use traits::{
        ConnectionPool,
        ConnectionFactory,
        MemoryManager,
        AsyncTaskPool,
        PooledConnection,
        PoolStats,
        MemoryStats,
        TaskStats,
        ConnectionState,
    };

    pub use connection::{
        GenericConnectionPool,
        ConnectionPoolConfig,
        ConnectionPoolBuilder,
    };

    pub use memory::{
        MemoryManagerImpl,
        MemoryPool,
        GcConfig,
        MemoryManagerBuilder,
    };

    pub use async_pool::{
        AsyncTaskPoolImpl,
        AsyncTaskPoolBuilder,
        create_default_async_pool,
        create_async_pool_with_workers,
    };

    pub use config::{
        PerformanceConfig,
        ConnectionPoolConfig as ConfigConnectionPoolConfig,
        ThreadPoolConfig,
        MemoryConfig,
        GcConfig as ConfigGcConfig,
        AsyncTaskPoolConfig,
        PerformanceConfigBuilder,
    };
}

fn main() {
    println!("开始测试performance模块...");
    
    // 测试连接池配置
    let connection_config = performance::ConnectionPoolConfig::default();
    println!("连接池配置创建成功: {:?}", connection_config);
    
    // 测试内存配置
    let memory_config = performance::MemoryConfig::default();
    println!("内存配置创建成功: {:?}", memory_config);
    
    // 测试异步任务池配置
    let async_config = performance::AsyncTaskPoolConfig::default();
    println!("异步任务池配置创建成功: {:?}", async_config);
    
    // 测试性能配置构建器
    let performance_config = performance::PerformanceConfigBuilder::new()
        .max_connections(200)
        .min_connections(20)
        .connection_timeout(60)
        .core_threads(8)
        .max_threads(16)
        .default_block_size(2048)
        .auto_gc_enabled(false)
        .async_worker_threads(8)
        .build()
        .expect("性能配置构建失败");
        
    println!("性能配置构建成功: {:?}", performance_config);
    
    println!("所有测试通过！performance模块重构成功。");
}